package com.android.fragmentdemo.adapters
import android.util.Log
import com.android.fragmentdemo.R
import com.android.fragmentdemo.databinding.ListDataRvItem2Binding
import com.android.fragmentdemo.databinding.ListDataRvSubItemBinding
import com.android.fragmentdemo.showToast
import com.hengfoxwolf.commonbase.base.adapter.BaseRvAdapter

class RvListDataAdapter() : BaseRvAdapter<String, ListDataRvSubItemBinding>() {

    //override fun getLayoutId() = R.layout.list_data_rv_item2

    override fun getLayoutId() = R.layout.list_data_rv_sub_item

    override fun bindData(holder: ViewHolder, dataItem: String, position: Int) {
        Log.d(TAG, "$TAG--${dataItem}")
        holder.binding.tvBodySubItem.text = dataItem
        //holder.binding.evgItemDataRoot.setItemData(dataItem)
    }

    override fun listenerWithBinding(binding: ListDataRvSubItemBinding) {
        super.listenerWithBinding(binding)
        binding.subItemRoot.setOnClickListener {
            binding.subItemRoot.context.showToast(binding.root.tag as String)
        }
    }

    override fun onViewRecycled(holder: ViewHolder) {
        super.onViewRecycled(holder)
        Log.d(TAG, "$TAG---fun onViewRecycled---")
    }

    companion object {
        const val TAG = "ListDataRvAdapter"
    }
}